//
//  Highet.m
//  网易新闻
//
//  Created by dllo on 16/6/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "Highet.h"

@implementation Highet

+(CGFloat)heightWith:(NSString *)text{
    NSDictionary *attrodoc = @{
                               NSFontAttributeName :[UIFont systemFontOfSize:20]
                               
                               };
    
    CGRect rect = [text boundingRectWithSize:CGSizeMake([UIScreen mainScreen].bounds.size.width, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:attrodoc context:nil];
    return rect.size.height;
}



+(CGFloat)imageHeightWith:(NSString *)imageName{
    
    UIImage *image = [UIImage imageNamed:imageName];
    

    CGFloat height = image.size.height * [UIScreen mainScreen].bounds.size.width/image.size.width ;
    
    
    return height;
    
    
}

+(CGFloat)imageHeightWithUrlstring:(NSString *)urlstring{
    NSURL *url = [NSURL URLWithString:urlstring];
    NSData *data = [NSData dataWithContentsOfURL:url];
    UIImage *image = [UIImage imageWithData:data];
    CGFloat height = image.size.height*[UIScreen mainScreen].bounds.size.width/image.size.width;
    
    
    return height;
    
}





@end
